package net.lanelife.casino.caipiao.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Index;
import javax.persistence.Table;

import net.lanelife.casino.caipiao.entity.support.UserRelationEntity;
import net.lanelife.casino.common.entity.annotation.Checked;
import net.lanelife.casino.common.utils.BillNoUtils;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "TB_PAYMENT_RECHARGE_ORDER", indexes = { 
	@Index(name = "IDX_BILLNO", columnList = "BILLNO"),
	@Index(name = "IDX_USER_ID", columnList = "USER_ID"),
	@Index(name = "IDX_USER_NAME", columnList = "USER_NAME"),
	@Index(name = "IDX_FLOOR", columnList = "FLOOR"),
	@Index(name = "IDX_PATH", columnList = "PATH"),
	@Index(name = "IDX_PARENT_ID", columnList = "PARENT_ID"),
	@Index(name = "IDX_PARENT_NAME", columnList = "PARENT_NAME")
})
public class PaymentRechargeOrder extends UserRelationEntity<Integer> {

	private static final long serialVersionUID = -5476275880381384937L;

	@Checked
	@Column(name = "BILLNO", length = 24, nullable = false)
	private String billNo = BillNoUtils.generateBillNo(BillNoUtils.PREFIX_PR);
	
	@Checked
	@Column(name = "TRANS_BILLNO", length = 24, nullable = false)
	private String transBillNo;
	
	@Checked
	@Column(name = "BANK_BILLNO", length = 24, nullable = false)
	private String bankBillNo;
	
	@Checked
	@Column(name = "PLATFORM_NAME", length = 10, nullable = false)
	private String platformName;
	
	@Checked
	@Column(name = "MERCHANT_NO", length = 10, nullable = false)
	private String merchantNo;
	
	@Checked
	@Column(name = "MERCHANT_NAME", length = 10, nullable = false)
	private String merchantName;
	
	@Checked
	@Column(name = "ORDER_AMOUNT", nullable = false)
	private Double orderAmount;
	
	@Checked
	@Column(name = "FACT_AMOUNT", nullable = false)
	private Double factAmount = 0D;
	
	@Checked
	@Column(name = "FEE", nullable = false)
	private Double fee = 0D;
	
	@Checked
	@Column(name = "SIGNATURE", length = 32, nullable = false)
	private String signature;
	
	@Checked
	@Column(name = "PAYER_BANK_NAME", length = 10, nullable = false)
	private String payerBankName;
	
	@Checked
	@Enumerated(EnumType.ORDINAL)
	@Column(name = "ORDER_STATUS", nullable = false)
	private OrderStatus orderStatus = OrderStatus.UNPAID;
	
	public static enum OrderStatus {
		PAID, UNPAID
	}

	public String getBillNo() {
		return billNo;
	}

	public void setBillNo(String billNo) {
		this.billNo = billNo;
	}

	public String getTransBillNo() {
		return transBillNo;
	}

	public void setTransBillNo(String transBillNo) {
		this.transBillNo = transBillNo;
	}

	public String getBankBillNo() {
		return bankBillNo;
	}

	public void setBankBillNo(String bankBillNo) {
		this.bankBillNo = bankBillNo;
	}

	public String getPlatformName() {
		return platformName;
	}

	public void setPlatformName(String platformName) {
		this.platformName = platformName;
	}

	public String getMerchantNo() {
		return merchantNo;
	}

	public void setMerchantNo(String merchantNo) {
		this.merchantNo = merchantNo;
	}

	public String getMerchantName() {
		return merchantName;
	}

	public void setMerchantName(String merchantName) {
		this.merchantName = merchantName;
	}

	public Double getOrderAmount() {
		return orderAmount;
	}

	public void setOrderAmount(Double orderAmount) {
		this.orderAmount = orderAmount;
	}

	public Double getFactAmount() {
		return factAmount;
	}

	public void setFactAmount(Double factAmount) {
		this.factAmount = factAmount;
	}

	public Double getFee() {
		return fee;
	}

	public void setFee(Double fee) {
		this.fee = fee;
	}

	public String getSignature() {
		return signature;
	}

	public void setSignature(String signature) {
		this.signature = signature;
	}

	public String getPayerBankName() {
		return payerBankName;
	}

	public void setPayerBankName(String payerBankName) {
		this.payerBankName = payerBankName;
	}

	public OrderStatus getOrderStatus() {
		return orderStatus;
	}

	public void setOrderStatus(OrderStatus orderStatus) {
		this.orderStatus = orderStatus;
	}

}
